/*
 * Copyright (C) 2011 Dirk Weißenborn, dirk.weissenborn@gmail.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.weissenborn.colabtex.client.service;

import java.util.List;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

/**
 * The Interface LaTexService which communicates latex related operations with the server
 */
@RemoteServiceRelativePath("LaTexService")
public interface LaTexService extends RemoteService {
	
	/**
	 * Creates or updates the pdf.
	 *
	 * @param padId the pad id
	 * @return the string
	 */
	public String createOrUpdatePdf(String padId);
	
	/**
	 * Gets the compile log.
	 *
	 * @param path the path
	 * @return the compile log
	 */
	public String getCompileLog(String padId);
	
	/**
	 * Send pdf file.
	 *
	 * @param path the path
	 * @param address the address
	 * @return whether file was sent or not
	 */
	public Boolean sendPdfFile(String padId, String address);
	
	/**
	 * Send tex file.
	 *
	 * @param padId the pad id
	 * @param address the address
	 * @return whether file was sent or not
	 */
	public Boolean sendTexFile(String padId, String address);
	
	public List<String> getResources(String padId);
	
	public Boolean deleteResource(String name, String padId);
	
	/**
	 * The Class Util.
	 */
	public static class Util {
		
		/** The instance. */
		private static LaTexServiceAsync instance;
		
		/**
		 * Gets the single instance of Util.
		 *
		 * @return single instance of Util
		 */
		public static LaTexServiceAsync getInstance(){
			if (instance == null) {
				instance = GWT.create(LaTexService.class);
			}
			return instance;
		}
	}
}
